#pragma once

#include <iostream>
#include <xmlrpc-c/client_simple.hpp>

#include "error.h"

namespace mcu {

using std::string;

typedef struct RtpMap {
  string type;
  int    codec;
}RtpMap;


class XmlRpc
{
public:
  XmlRpc() = delete;
  ~XmlRpc();


  static error CreateEventQueue(string& url, int* pID);
  static error DeleteEventQueue(string& url, int id);
  static error CreateConference(string& url, string& tags, int vad, int rate,int queueID, int* pID);
  static error DeleteConference(string& url, int confID);

  static error CreateMosaic(string& url, int confID, int comp, int size, int* pID);
  static error DeleteMosaic(string& url, int confID, int mosaicID);

  static error CreateSidebar(string& url, int confID, int* pID);
  static error DeleteSidebar(string& url, int confID, int sidebarID);

  static error CreateParticipant(string& url,int confID, int mosaicID,
               int sidebarID, string& sname, string& token, int type,  int* pID);
  static error DeleteParticipant(string& url,int confID, int partID);

  static error StartPublishing(string& url, int confID, string& rtmpServer,
               int port, string& app, string& stream, int* pID);
  static error StopPublishing(string& url, int confID, int id);

  static error StartReceiving(string& url, int confID, int partID,
              int media, RtpMap& rtpMap, RtpMap& aptMap, int* pPort);
  static error StopReceiving(string& url, int confID, int partID, int media);

private:
  static xmlrpc_c::clientSimple _xmlrpc;
};


};
